home *** CD-ROM | disk | FTP | other *** search
/ Aminet 25 / Aminet 25 (1998)(GTI - Schatztruhe)[!][Jun 1998].iso / Aminet / util / libs / ixemul_sdk.lha / include / sys / shm.h < prev    next >
C/C++ Source or Header  |  1998-01-15  |  3KB  |  90 lines

  1. /*    $NetBSD: shm.h,v 1.20 1996/04/09 20:55:35 cgd Exp $    */
  2.  
  3. /*
  4.  * Copyright (c) 1994 Adam Glass
  5.  * All rights reserved.
  6.  *
  7.  * Redistribution and use in source and binary forms, with or without
  8.  * modification, are permitted provided that the following conditions
  9.  * are met:
  10.  * 1. Redistributions of source code must retain the above copyright
  11.  *    notice, this list of conditions and the following disclaimer.
  12.  * 2. Redistributions in binary form must reproduce the above copyright
  13.  *    notice, this list of conditions and the following disclaimer in the
  14.  *    documentation and/or other materials provided with the distribution.
  15.  * 3. All advertising materials mentioning features or use of this software
  16.  *    must display the following acknowledgement:
  17.  *      This product includes software developed by Adam Glass.
  18.  * 4. The name of the author may not be used to endorse or promote products
  19.  *    derived from this software without specific prior written permission
  20.  *
  21.  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  22.  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  23.  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  24.  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  25.  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  26.  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  27.  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  28.  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  29.  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  30.  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31.  */
  32.  
  33. /*
  34.  * As defined+described in "X/Open System Interfaces and Headers"
  35.  *                         Issue 4, p. XXX
  36.  */
  37.  
  38. #ifndef _SYS_SHM_H_
  39. #define _SYS_SHM_H_
  40.  
  41. #include <sys/ipc.h>
  42.  
  43. #define    SHM_RDONLY    010000    /* Attach read-only (else read-write) */
  44. #define    SHM_RND        020000    /* Round attach address to SHMLBA */
  45. #define    SHMLBA        CLBYTES    /* Segment low boundry address multiple */
  46.  
  47. /* Some systems (e.g. HP-UX) take these as the second (cmd) arg to shmctl(). */
  48. #define    SHM_LOCK    3    /* Lock segment in memory. */
  49. #define    SHM_UNLOCK    4    /* Unlock a segment locked by SHM_LOCK. */
  50.  
  51. struct shmid_ds {
  52.     struct ipc_perm    shm_perm;    /* operation permission structure */
  53.     int        shm_segsz;    /* size of segment in bytes */
  54.     pid_t        shm_lpid;    /* process ID of last shm op */
  55.     pid_t        shm_cpid;    /* process ID of creator */
  56.     short        shm_nattch;    /* number of current attaches */
  57.     time_t        shm_atime;    /* time of last shmat() */
  58.     time_t        shm_dtime;    /* time of last shmdt() */
  59.     time_t        shm_ctime;    /* time of last change by shmctl() */
  60.     void        *shm_internal;    /* sysv stupidity */
  61. };
  62.  
  63. #include <sys/cdefs.h>
  64.  
  65. #ifdef _KERNEL
  66.  
  67. struct shm_list
  68. {
  69.   struct shmid_ds       ds;
  70.   struct shm_list       *next;
  71. };
  72.  
  73. #define    SHMSEG_FREE         0x0200
  74. #define    SHMSEG_REMOVED      0x0400
  75. #define    SHMSEG_ALLOCATED    0x0800
  76. #define    SHMSEG_WANTED        0x1000
  77.  
  78. #define IPC_SHMID(perm) (((perm).seq << 18) | (((long)&(perm)) & 0x3fffc))
  79.  
  80. #endif
  81.  
  82. __BEGIN_DECLS
  83. void *shmat __P((int, void *, int));
  84. int shmctl __P((int, int, struct shmid_ds *));
  85. int shmdt __P((void *));
  86. int shmget __P((key_t, int, int));
  87. __END_DECLS
  88.  
  89. #endif /* !_SYS_SHM_H_ */
  90.